/**
 * Aug 6, 2007
 */
package com.sinodata.bsm.common.vo;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;

/**
 * 
 * <p>
 * Description: 本对象用于采集结果的封装，并在Probe-Center上传的时候使用。
 * </p>
 *
 * @author tangli
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2012-5-9 下午1:47:02          tangli         1.0         To create
 * </p>
 *
 * @since 
 * @see
 */
public class ResPropertyValue implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private Long resId;
    private Long taskId;
    private Date time;
    private boolean isTemporary;
    private PropValue[] values = new PropValue[0];

    /**
     * 批量采集得到的资源指标值要设置这个属性，
     * 该属性为对应资源的内部唯一标示符
     */
    private String inid;

    public static PropValue createPropValue(Long propId, String value, String field) {
        PropValue propValue = new PropValue();
        propValue.propId = propId;
        propValue.value = value;
        propValue.field = field;
        return propValue;
    }

    public static PropValue createPropValue(String value, String field) {
        PropValue propValue = new PropValue();
        propValue.value = value;
        propValue.field = field;
        return propValue;
    }

    public static class PropValue implements Serializable {
        /**
         *
         */
        private static final long serialVersionUID = 1L;
        public Long propId;
        public String value;
        public String field;
        public String inid;

        public PropValue() {
        }

        public PropValue(String field, String value) {
            super();
            this.field = field;
            this.value = value;
        }

        @Override
        public String toString() {
            return "PropValue [propId=" + propId + ", value=" + value + ", field=" + field + "]";
        }
    }

    /**
     *
     */
    public ResPropertyValue() {
    }

    /**
     * @return the resId
     */
    public Long getResId() {
        return resId;
    }

    /**
     * @param resId the resId to set
     */
    public void setResId(Long resId) {
        this.resId = resId;
    }

    /**
     * @return the time
     */
    public Date getTime() {
        return time;
    }

    /**
     * @param time the time to set
     */
    public void setTime(Date time) {
        this.time = time;
    }

    /**
     * @return the values
     */
    public PropValue[] getValues() {
        return values;
    }

    /**
     * @param values the values to set
     */
    public void setValues(PropValue... values) {

        this.values = values;
    }

    public Long getTaskId() {
        return taskId;
    }

    public void setTaskId(Long taskId) {
        this.taskId = taskId;
    }

    public boolean isTemporary() {
        return isTemporary;
    }

    public void setTemporary(boolean isTemporary) {
        this.isTemporary = isTemporary;
    }

    public String getInid() {
        return inid;
    }

    public void setInid(String inid) {
        this.inid = inid;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "ResPropertyValue [resId=" + resId + ", time=" + time + ", taskId=" + taskId + ", temporary=" + isTemporary + ", values=" + Arrays.toString(values) + "]";
    }

}
